package cn.damai.controller.web;

import cn.damai.content.service.HomeService;

import cn.damai.model.User;
import cn.damai.util.DubboUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.Map;


/**
 * 页面起始位置
 */

@Controller
@RequestMapping
public class HomeController {

    @Reference(url = DubboUtil.CONTENT_URL,version = DubboUtil.VRESION,group = DubboUtil.GROUP)
    private HomeService homeService;

//  首页跳转
    @RequestMapping("/")
    public String home(){
        return "forward:/listAll";
    }

//  首页显示内容
    @RequestMapping("listAll")
    public String listAll(Model model){
        Map<String,Object> map = homeService.listItemToHome();

        model.addAttribute("event",map);
        return "index";
    }

}
